package com.design.yjx.adapter;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Vector;

/**
 * @author yuanjianxin
 * @date 2017/8/22 10:09
 * 适配器模式
 */
public class Main {
    public static void main(String[] args) {
        List<String> list = new ArrayList<>();

        list.add("a");
        list.add("c");
        list.add("d");
        list.add("r");

        Iterator<String> iterator = list.iterator();
        while (iterator.hasNext()) {
            String next = iterator.next();
            System.out.println(next);
        }

        Vector<String> vector = new Vector<>();
        vector.add("1");
        vector.add("2");
        vector.add("3");

        EnumerationIterator adapter = new EnumerationIterator(vector.elements());
        while (adapter.hasNext()) {
            String next = (String) adapter.next();
            System.out.println(next);
        }
    }
}
